package ClassThree;

/**
 * @author gao
 * @date 2025/6/3 20:53
 */

public class Song {
    public String title;//标题
    public String artist;//歌手

    public void setTitle(String title) {
        //this引用，只用于指向当前对象，不能再引用其他对象
        //只在成员方法中使用
        this.title = title;
    }

    public void setArtist(String artist) {
        this.artist = artist;
    }

    public void play() {
        System.out.println(this.artist + " is singing " + this.title);
    }

    public static void main(String[] args) {
        //编译器会生成一份默认的构造方法，生成的默认构造方法一定是无参的。
        Song song1 = new Song();
        Song song2 = new Song();
        Song song3 = new Song();

        song1.setArtist("Jay Chou");
        song1.setTitle("稻香");
        song1.play();
    }
}